home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Think Class Libraries / TP TCL->CW TCL v1.1.2.3 / UPI ƒ / Updated UPIs ƒ / PasLibIntf.p < prev    next >
Text File  |  1996-02-07  |  6KB  |  249 lines

  1. {*-------------------------------------------------------------------------------*
  2.  |                                                                                 |
  3.  |                          <<< Pascal Library Interface >>>                         |
  4.  |                                                                                 |
  5.  |                      Copyright Apple Computer, Inc. 1986, 1992                  |
  6.  |                               All rights reserved.                              |
  7.  |                                                                                 |
  8.  *-------------------------------------------------------------------------------*}
  9.  
  10. {
  11.  Interface to the Pascal I/O and Memory Manager Library.
  12.  Built-in procedure and function declarations are marked with
  13.  the (* *) comment characters
  14. }
  15.  
  16. {$IFC UNDEFINED UsingIncludes}
  17. {$SETC UsingIncludes := 0}
  18. {$ENDC}
  19.  
  20. {$IFC NOT UsingIncludes}
  21.     UNIT PASLIBIntf;
  22.       INTERFACE
  23. {$ENDC}
  24.  
  25. {$IFC UNDEFINED UsingPASLIBINTF}
  26. {$SETC UsingPASLIBINTF := 1}
  27.  
  28. {$I+}
  29. {$SETC PASLIBINTFIncludes := UsingIncludes}
  30. {$SETC UsingIncludes := 1}
  31. {$IFC UNDEFINED UsingTypes}
  32. {$I $$Shell(PInterfaces)Types.p}
  33. {$ENDC}
  34. {$IFC UNDEFINED UsingFiles}
  35. {$I $$Shell(PInterfaces)Files.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED UsingAliases}
  38. {$I $$Shell(PInterfaces)Aliases.p}
  39. {$ENDC}
  40. {$SETC UsingIncludes := PASLIBINTFIncludes}
  41.  
  42.     TYPE
  43.       PASCALPOINTER = ^INTEGER; { Universal POINTER type }
  44.       PASCALFILE = FILE; { Universal FILE type }
  45. (*
  46.  *      PASCALBLOCK =    { Universal block of chars }
  47.  *            PACKED ARRAY [0..511] OF CHAR;
  48.  *)
  49.  
  50.     CONST
  51.       { <StdIO.h> PLSetVBuf styles }
  52.       _IOFBF = $00; { File buffering }
  53.       _IOLBF = $40; { Line buffering }
  54.       _IONBF = $04; { No buffering }
  55.  
  56. {
  57.  Mac Pascal heap management
  58. }
  59.  
  60.     PROCEDURE PLHeapInit(sizepheap: LONGINT; heapDelta: LONGINT;
  61.                          memerrProc: UNIV PASCALPOINTER; allowNonCont: BOOLEAN;
  62.                          forDispose: BOOLEAN);
  63. {
  64.  The following procedure is obsolete, use PLHeapInit
  65. }
  66.  
  67.     PROCEDURE PLInitHeap(sizepheap: LONGINT; memerrProc: UNIV PASCALPOINTER;
  68.                          allowNonCont: BOOLEAN; allowDispose: BOOLEAN);
  69.  
  70.     PROCEDURE PLSetNonCont(allowNonCont: BOOLEAN);
  71.  
  72.     PROCEDURE PLSetMErrProc(memerrProc: UNIV PASCALPOINTER);
  73.  
  74.     PROCEDURE PLSetHeapType(forDispose: BOOLEAN);
  75.  
  76.     PROCEDURE PLSetHeapCheck(DoIt: BOOLEAN);
  77.  
  78. {
  79.  File I/O
  80. }
  81.  
  82. (*
  83.  *      PROCEDURE
  84.  *        RESET(VAR fvar:  UNIV PASCALFILE; OPT fname: STRING);
  85.  *        BUILTIN;
  86.  *
  87.  *      PROCEDURE
  88.  *        REWRITE(VAR fvar: UNIV PASCALFILE; OPT fname: STRING);
  89.  *        BUILTIN;
  90.  *
  91.  *      PROCEDURE
  92.  *        OPEN(VAR fvar:    UNIV PASCALFILE; fname: STRING);
  93.  *        BUILTIN;
  94.  *)
  95.  
  96.     PROCEDURE PLSetVBuf(VAR fvar: TEXT; buffer: UNIV PASCALPOINTER;
  97.                         style: INTEGER; bufsize: INTEGER);
  98. (*
  99.  *      FUNCTION
  100.  *        BLOCKREAD(
  101.  *          VAR fvar: FILE;
  102.  *          VAR buffer: UNIV PASCALBLOCK;
  103.  *          nBlocks: INTEGER;
  104.  *          OPT stBlock:INTEGER
  105.  *        ):
  106.  *        INTEGER;
  107.  *        BUILTIN;
  108.  *
  109.  *      FUNCTION
  110.  *        BLOCKWRITE(
  111.  *          VAR fvar: FILE;
  112.  *          VAR buffer: UNIV PASCALBLOCK;
  113.  *          nBlocks: INTEGER;
  114.  *          OPT stBlock:INTEGER
  115.  *        ):
  116.  *        INTEGER;
  117.  *        BUILTIN;
  118.  *
  119.  *      FUNCTION
  120.  *        BYTEREAD(
  121.  *          VAR fvar: FILE;
  122.  *          VAR buffer: UNIV PASCALBLOCK;
  123.  *          nBytes:  LONGINT;
  124.  *          OPT stByte: LONGINT
  125.  *        ):
  126.  *        LONGINT;
  127.  *        BUILTIN;
  128.  *
  129.  *      FUNCTION
  130.  *        BYTEWRITE(
  131.  *          VAR fvar: FILE;
  132.  *          VAR buffer: UNIV PASCALBLOCK;
  133.  *          nBytes:  LONGINT;
  134.  *          OPT stByte: LONGINT
  135.  *        ):
  136.  *        LONGINT;
  137.  *        BUILTIN;
  138.  *
  139.  *      FUNCTION
  140.  *        EOF(OPT VAR fvar: UNIV PASCALFILE):
  141.  *        BOOLEAN;
  142.  *        BUILTIN;
  143.  *
  144.  *      FUNCTION
  145.  *        EOLN(OPT VAR fvar: TEXT):
  146.  *        BOOLEAN;
  147.  *        BUILTIN;
  148.  *
  149.  *      PROCEDURE
  150.  *        READ(VAR fvar: TEXT; OPT EXPR_LIST);
  151.  *        BUILTIN;
  152.  *
  153.  *      PROCEDURE
  154.  *        READLN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
  155.  *        BUILTIN;
  156.  *
  157.  *      PROCEDURE
  158.  *        WRITE(VAR fvar: TEXT; OPT EXPR_LIST);
  159.  *        BUILTIN;
  160.  *
  161.  *      PROCEDURE
  162.  *        WRITELN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
  163.  *        BUILTIN;
  164.  *
  165.  *      PROCEDURE
  166.  *        GET(VAR fvar: UNIV PASCALFILE);
  167.  *        BUILTIN;
  168.  *
  169.  *      PROCEDURE
  170.  *        PUT(VAR fvar: UNIV PASCALFILE);
  171.  *        BUILTIN;
  172.  *
  173.  *      PROCEDURE
  174.  *        SEEK(VAR fvar: UNIV PASCALFILE; recno: LONGINT);
  175.  *        BUILTIN;
  176.  *)
  177.  
  178.     FUNCTION PLFilePos(VAR fvar: UNIV PASCALFILE): LONGINT;
  179.  
  180.     PROCEDURE PLFlush(VAR fvar: TEXT);
  181.  
  182.     PROCEDURE PLCrunch(VAR fvar: UNIV PASCALFILE);
  183.     
  184. {
  185.  Directory operations.
  186. }
  187.  
  188.     PROCEDURE PLPurge(fname: STRING);
  189.  
  190.     PROCEDURE PLRename(oldFname, newFname: STRING);
  191.  
  192. {
  193.  Miscellaneous Operations
  194. }
  195.  
  196.     FUNCTION TrapAvailable(trap: INTEGER): BOOLEAN;
  197.  
  198.     FUNCTION ResolveFolderAliases (volume: INTEGER; directory: LONGINT;
  199.                                    path: Str255; resolveLeafName: BOOLEAN;
  200.                                    VAR theSpec: FSSpec; VAR isFolder, hadAlias,
  201.                                    leafIsAlias: BOOLEAN): OSErr; C; EXTERNAL;
  202.  
  203.     FUNCTION MakeResolvedFSSpec (volume: INTEGER; directory: LONGINT;
  204.                                  path: Str255; VAR theSpec: FSSpec; VAR isFolder,
  205.                                  hadAlias, leafIsAlias: BOOLEAN): OSErr; C; EXTERNAL;
  206.     
  207.     FUNCTION IEResolvePath (VAR rawPath: Str255; VAR resolvedPath: Str255;
  208.                             VAR isFolder, hadAlias: BOOLEAN): OSErr;
  209.  
  210.     FUNCTION MakeResolvedPath (volume: INTEGER; directory: LONGINT; path: Str255;
  211.                                resolveLeafAlias: BOOLEAN; VAR buffer: Str255;
  212.                                VAR isFolder, hadAlias, leafIsAlias: BOOLEAN):
  213.                                OSErr; C; EXTERNAL;
  214.  
  215. {
  216.  C string functions for Pascal strings
  217. }
  218.      FUNCTION PLStrCmp(string1, string2: STR255): INTEGER;
  219.  
  220.     FUNCTION PLStrnCmp(string1, string2: STR255; n: INTEGER): INTEGER;
  221.  
  222.     FUNCTION PLStrCpy(VAR string1: STR255; string2: STR255): STRINGPTR;
  223.  
  224.     FUNCTION PLStrnCpy(VAR string1: STR255; string2: STR255; n: INTEGER): STRINGPTR;
  225.  
  226.     FUNCTION PLStrCat(VAR string1: STR255; string2: STR255): STRINGPTR;
  227.  
  228.     FUNCTION PLStrnCat(VAR string1: STR255; string2: STR255; n: INTEGER): STRINGPTR;
  229.  
  230.     FUNCTION PLStrChr(string1: STR255; c: CHAR): PTR;
  231.  
  232.     FUNCTION PLStrrChr(string1: STR255; c: CHAR): PTR;
  233.  
  234.     FUNCTION PLStrPBrk(string1, string2: STR255): PTR;
  235.  
  236.     FUNCTION PLStrSpn(string1, string2: STR255): INTEGER;
  237.  
  238.     FUNCTION PLStrStr(string1, string2: STR255): PTR;
  239.  
  240.     FUNCTION PLStrLen(string1: STR255): INTEGER;
  241.     
  242.     FUNCTION PLPos(STRING1: STR255; STRING2: STR255): INTEGER;
  243.  
  244. {$ENDC}    { UsingPASLIBINTF }
  245.  
  246. {$IFC NOT UsingIncludes}
  247.     END.
  248. {$ENDC}
  249.